import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, Min, MinLength } from 'class-validator';

export class RegisterUserDto {
    @IsNotEmpty({
        message: '用户名不能为空',
    })
    @ApiProperty()
    username: string;

    @IsNotEmpty({
        message: '密码不能为空',
    })
    @MinLength(6, { message: '密码不能小于6位' })
    @ApiProperty()
    password: string;

    @IsNotEmpty({
        message: '昵称不能为空',
    })
    @ApiProperty()
    nickname: string;

    @IsNotEmpty({
        message: '邮箱不能为空',
    })
    @IsEmail(
        {},
        {
            message: '不是合法的邮箱格式',
        },
    )
    @ApiProperty()
    email: string;

    @IsNotEmpty({
        message: '验证码不能为空',
    })
    @ApiProperty()
    captcha: string;
}

export class UpdatePasswordDto {
    @IsNotEmpty({
        message: '密码不能为空',
    })
    @MinLength(6, { message: '密码不能小于6位' })
    password: string;

    @IsNotEmpty({ message: '邮箱不能为空' })
    @IsEmail({}, { message: '邮箱格式错误' })
    email: string;

    @IsNotEmpty({ message: '验证码不能为空' })
    captcha: string;
}
